package com.service.atf.base.model;

import com.service.atf.base.core.ByteConvertion;
import com.luotao.devp.base.utils.ByteUtil;

/**
 * User: luotao
 * Date: 12-2-23
 * Time: 15:52:00
 * �����˻�����	�ַ�char(20)	ʡ����+�б���+SEQ	�ֻ�ͻ���
 * ������Ϸ����	int		�ͻ���
 * ������Ϸʱ��	Int
 */
public class TFGameEnter extends BaseHeader implements ByteConvertion {

    private int gamecode;

    private int enterGameDate;

    public TFGameEnter() {
        setType((byte) '1');
        setTradeType((byte) '8');
    }

    public int getGamecode() {
        return gamecode;
    }

    public void setGamecode(int gamecode) {
        this.gamecode = gamecode;
    }

    public int getEnterGameDate() {
        return enterGameDate;
    }

    public void setEnterGameDate(int enterGameDate) {
        this.enterGameDate = enterGameDate;
    }

    @Override
    public ByteConvertion byte2Object(byte[] src) {
        byte2ObjectHeader(src);
        setGamecode(ByteUtil.readInt(src, LEN_HEAD));
        setEnterGameDate(ByteUtil.readInt(src, LEN_HEAD + 4));
        return this;
    }

    @Override
    public byte[] object2Byte() {
        byte[] result = new byte[LEN_HEAD + 8];
        byte[] head = object2ByteHeader();
        System.arraycopy(head, 0, result, 0, head.length);
        ByteUtil.writeInt(result, LEN_HEAD, getGamecode());
        ByteUtil.writeInt(result, LEN_HEAD + 4, getEnterGameDate());
        return result;
    }
}
